<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<link href="https://cdn.bootcss.com/KaTeX/0.7.1/katex.min.css" rel="stylesheet">








<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="机器学习," />










<meta name="description" content="Todo.">
<meta name="keywords" content="机器学习">
<meta property="og:type" content="article">
<meta property="og:title" content="线性分类器">
<meta property="og:url" content="http://ukaii.cn/2019/04/25/线性分类器/index.html">
<meta property="og:site_name" content="uKaii">
<meta property="og:description" content="Todo.">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://ukaii.cn/2019/04/25/线性分类器/reversibility-proof.jpg">
<meta property="og:updated_time" content="2019-12-23T08:09:16.831Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="线性分类器">
<meta name="twitter:description" content="Todo.">
<meta name="twitter:image" content="http://ukaii.cn/2019/04/25/线性分类器/reversibility-proof.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://ukaii.cn/2019/04/25/线性分类器/"/>





  <title>线性分类器 | uKaii</title><!-- hexo-inject:begin --><!-- hexo-inject:end -->
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">uKaii</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-主页">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            主页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-标签">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-目录">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            目录
          </a>
        </li>
      
        
        <li class="menu-item menu-item-时间轴">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            时间轴
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br />
            
            日程表
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://ukaii.cn/2019/04/25/线性分类器/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="uKaii">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/assets/img/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="uKaii">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">线性分类器</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-04-25T23:19:26+08:00">
                2019-04-25
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/机器学习/" itemprop="url" rel="index">
                    <span itemprop="name">机器学习</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/机器学习/线性分类器/" itemprop="url" rel="index">
                    <span itemprop="name">线性分类器</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  719字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  3min
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>Todo.<br><a id="more"></a></p>
<h1 id="线性回归"><a href="#线性回归" class="headerlink" title="线性回归"></a>线性回归</h1><h2 id="模型总览"><a href="#模型总览" class="headerlink" title="模型总览"></a>模型总览</h2><h3 id="模型"><a href="#模型" class="headerlink" title="模型"></a>模型</h3><script type="math/tex; mode=display">
h_\theta(x)=\theta^Tx</script><h3 id="优化目标"><a href="#优化目标" class="headerlink" title="优化目标"></a>优化目标</h3><script type="math/tex; mode=display">
J(\theta)=\frac1m\sum_{i-1}^{m}\frac12(h_\theta(x^{(i)})-y^{(i)})^2</script><h3 id="优化算法"><a href="#优化算法" class="headerlink" title="优化算法"></a>优化算法</h3><ul>
<li><p>梯度下降</p>
</li>
<li><p>正规方程</p>
</li>
</ul>
<h2 id="梯度下降"><a href="#梯度下降" class="headerlink" title="梯度下降"></a>梯度下降</h2><script type="math/tex; mode=display">
\theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}J(\theta)\qquad(j=0,...,n)</script><h3 id="随机梯度下降"><a href="#随机梯度下降" class="headerlink" title="随机梯度下降"></a>随机梯度下降</h3><p>每次从样本集中选取$1$个样本，去更新$\theta_j$的值<br>这种更新规则称为最小二乘规则（LMS rule），或者叫做Widrow-Hoff学习规则。若$x^{(i)}$的选择是随机的，这个方法也叫叫随机梯度下降法（SGD）。</p>
<script type="math/tex; mode=display">
\theta_j := \theta_j + \alpha (y^{(i)}-h_\theta (x^{(i)}))x_j^{(i)}</script><h3 id="批量梯度下降"><a href="#批量梯度下降" class="headerlink" title="批量梯度下降"></a>批量梯度下降</h3><p>每次从样本集中选取$m$个样本，去更新$\theta_j$的值</p>
<script type="math/tex; mode=display">
\begin{aligned}
&重复直到收敛 \{ \\
&\qquad\theta_j := \theta_j + \alpha \sum^n_{i=1}(y^{(i)}-h_\theta (x^{(i)}))x_j^{(i)}*\red{\frac1m}\quad(对每个j) \\
&\}
\end{aligned}</script><p>疑惑点：后面是否要乘以$\frac1m$</p>
<h3 id="随机梯度下降-1"><a href="#随机梯度下降-1" class="headerlink" title="随机梯度下降"></a>随机梯度下降</h3><script type="math/tex; mode=display">
\begin{aligned}
&\text{Loop}：\{ \\
&\qquad \text{for}\ i=1\ \text{to}\ n,\{   \\
&\qquad\qquad\theta_j := \theta_j  +\alpha(y^{(i)}-h_{\theta}(x^{(i)}))x_j^{(i)} \qquad(对每个 j) \\
&\qquad\}  \\
&\}
\end{aligned}</script><h3 id="实例"><a href="#实例" class="headerlink" title="实例"></a>实例</h3><p>可以把$x_i$做任意映射如：$2^{x_i}$，梯度下降依旧可以进行，</p>
<script type="math/tex; mode=display">
h_\theta(x)=\theta_0+\theta_1f_1(x_1)+\theta_2f_2(x_2)</script><p>实际过程如下</p>
<script type="math/tex; mode=display">
\begin{aligned}
&\text{Loop}：\{ \\
&\qquad \text{for}\ i=1\ \text{to}\ n,\{   \\
&\qquad\qquad\theta_j := \theta_j  +\alpha(y^{(i)}-h_{\theta}(x^{(i)}))f_j(x_j^{(i)}) \qquad(对每个 j) \\
&\qquad\}  \\
&\}
\end{aligned}</script><p>_</p>
<h2 id="正规方程"><a href="#正规方程" class="headerlink" title="正规方程"></a>正规方程</h2><p>根据最小二乘法推倒出，可以直接从训练样本计算出$\theta$，可证明计算出的$\theta$是最优值:</p>
<script type="math/tex; mode=display">
\theta=(X^TX)^{-1}X^Ty</script><p>Octove中可如下求解</p>
<figure class="highlight matlab"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">pinv(X):伪逆</span><br><span class="line">inv(X):可逆</span><br><span class="line">pinv(X'*X)*X'*y</span><br></pre></td></tr></table></figure>
<p>一般来说$X^TX$是可逆的。如果不可逆，可能是由于包含了多余的特征</p>
<p>可逆性的证明如下<br><img src="/2019/04/25/线性分类器/reversibility-proof.jpg"></p>
<h2 id="梯度下降与正规方程比较"><a href="#梯度下降与正规方程比较" class="headerlink" title="梯度下降与正规方程比较"></a>梯度下降与正规方程比较</h2><div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">梯度下降</th>
<th style="text-align:center">正规方程</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">需要选择学习率</td>
<td style="text-align:center">不需要</td>
</tr>
<tr>
<td style="text-align:center">需要多次迭代</td>
<td style="text-align:center">一次运算得出</td>
</tr>
<tr>
<td style="text-align:center">当特征数量n大时也能较好适用$o(kn^2)$</td>
<td style="text-align:center">需要计算$(X^TX)^{-1}$如果特征数量n较大则运算代价大，因为矩阵逆的计算时间复杂度为$o(n^3)$，通常来说当n小于10000 时还是可以接受的</td>
</tr>
<tr>
<td style="text-align:center">适用于各种类型的模型</td>
<td style="text-align:center">只适用于线性模型，不适合逻辑回归模型等其他模型</td>
</tr>
</tbody>
</table>
</div>
<h2 id="避免过拟合"><a href="#避免过拟合" class="headerlink" title="避免过拟合"></a>避免过拟合</h2><ul>
<li><p><strong>删选特征</strong></p>
</li>
<li><p><strong>正则化</strong></p>
<ul>
<li>在代价函数中加入正则项，使参数$w$变小</li>
</ul>
</li>
<li><p><strong>特征缩放 feature scaling</strong></p>
<ul>
<li>章节5 课时30</li>
</ul>
</li>
<li><p><strong>归一化、标准化</strong></p>
</li>
</ul>
<h2 id="代价函数推导"><a href="#代价函数推导" class="headerlink" title="代价函数推导"></a>代价函数推导</h2><ul>
<li><p><strong>MAP 估计</strong></p>
</li>
<li><p><strong>ML 估计</strong></p>
</li>
<li><p><strong>最小二乘估计</strong></p>
<ul>
<li>与ML估计是等价的，推导过程不一样</li>
</ul>
</li>
<li><p><strong>正则最小二乘估计</strong></p>
</li>
</ul>
<script type="math/tex; mode=display">
J(\theta)=\frac1m\sum_{i-1}^{m}\frac12\left[(h_\theta(x^{(i)})-y^{(i)})^2+\lambda\sum_{j=1}^n\theta_j^2\right]</script><h2 id="其他形式"><a href="#其他形式" class="headerlink" title="其他形式"></a>其他形式</h2><div class="table-container">
<table>
<thead>
<tr>
<th></th>
<th>损失函数</th>
<th>优化方法</th>
</tr>
</thead>
<tbody>
<tr>
<td>线性回归</td>
<td></td>
<td></td>
</tr>
<tr>
<td>岭回归（L2正则化）</td>
<td></td>
<td></td>
</tr>
<tr>
<td>Lasso回归（L1正则化）</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h1 id="logistic-回归"><a href="#logistic-回归" class="headerlink" title="logistic 回归"></a>logistic 回归</h1><h2 id="模型总览-1"><a href="#模型总览-1" class="headerlink" title="模型总览"></a>模型总览</h2><h3 id="模型-1"><a href="#模型-1" class="headerlink" title="模型"></a>模型</h3><script type="math/tex; mode=display">
h_\theta(x)=sigmoid(\theta^Tx)</script><p>模型的一种解释</p>
<p>假设我们的结果是伯努利分布，我们可以得到y的概率分布</p>
<script type="math/tex; mode=display">
\begin{aligned}
p(y;\phi) & = \phi ^y(1-\phi)^{1-y}\\
& = exp(y \log \phi + (1-y)\log(1-\phi))\\
& = exp( (log (\frac {\phi}{1-\phi}))y+\log (1-\phi) )\\
\end{aligned} \tag{2.2}</script><p>进而可以求得y的期望</p>
<script type="math/tex; mode=display">
\begin{aligned}
h_\theta(x)& = E[y|x;\theta] \\
& = \phi \\
& = 1/(1+ e^{-\eta}) \\
& = 1/(1+ e^{-\theta^Tx})\\
\end{aligned}</script><h3 id="优化目标-1"><a href="#优化目标-1" class="headerlink" title="优化目标"></a>优化目标</h3><p><strong>优化算法</strong></p>
<ul>
<li>梯度下降</li>
</ul>
<h2 id=""><a href="#" class="headerlink" title=" "></a> </h2><h2 id="梯度下降-1"><a href="#梯度下降-1" class="headerlink" title="梯度下降"></a>梯度下降</h2><h1 id="感知器"><a href="#感知器" class="headerlink" title="感知器"></a>感知器</h1><h2 id="模型总览："><a href="#模型总览：" class="headerlink" title="模型总览："></a>模型总览：</h2><p><strong>模型</strong></p>
<p><strong>优化目标</strong></p>
<script type="math/tex; mode=display">
\begin{aligned}
J(\theta)&=\text{cost}(h_\theta(x),y)\\
&=-y\text{log}(h_\theta(x))-(1-y)\text{log}(1-h_\theta(x))
\end{aligned}
\tag{*}</script><script type="math/tex; mode=display">
J(\theta)=\frac1m\sum_{i-1}^{m}\left[-y\text{log}(h_\theta(x))-(1-y)\text{log}(1-h_\theta(x))\right]</script><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">set terminal svg</span><br><span class="line">set title &quot;cost plots&quot; font &quot;,20&quot;</span><br><span class="line">set key left box</span><br><span class="line">set samples 100</span><br><span class="line">set style data points</span><br><span class="line"></span><br><span class="line">plot [0:2] [0:4] -log(x),-log(1-x)</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">set terminal svg</span><br><span class="line">set title &quot;cost plots&quot; font &quot;,20&quot;</span><br><span class="line">set key left box</span><br><span class="line">set samples 100</span><br><span class="line">set style data points</span><br><span class="line"></span><br><span class="line">plot [0:1] (0.3**x)*(0.3**(1-x))</span><br></pre></td></tr></table></figure>
<p><strong>优化算法</strong></p>
<p>用梯度下降法，对$\theta$进行更新</p>
<script type="math/tex; mode=display">
\theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}j(\theta)</script><p>求导后可得</p>
<script type="math/tex; mode=display">
\theta_j:=\theta_j-\alpha\sum_{i=1}^{m}(h_\theta(x^{(i)}-y^{(i)})x_j^{(i)}</script><h2 id="优缺点"><a href="#优缺点" class="headerlink" title="优缺点"></a>优缺点</h2>
      
    </div>
    
    
    

    

    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    uKaii
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://ukaii.cn/2019/04/25/线性分类器/" title="线性分类器">http://ukaii.cn/2019/04/25/线性分类器/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/机器学习/" rel="tag"># 机器学习</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/08/16/scheme基础/" rel="next" title="scheme基础">
                <i class="fa fa-chevron-left"></i> scheme基础
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/04/29/Hexo踩坑记录/" rel="prev" title="Hexo踩坑记录">
                Hexo踩坑记录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/assets/img/avatar.jpg"
                alt="uKaii" />
            
              <p class="site-author-name" itemprop="name">uKaii</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives">
              
                  <span class="site-state-item-count">34</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">17</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">17</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#线性回归"><span class="nav-number">1.</span> <span class="nav-text">线性回归</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#模型总览"><span class="nav-number">1.1.</span> <span class="nav-text">模型总览</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#模型"><span class="nav-number">1.1.1.</span> <span class="nav-text">模型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#优化目标"><span class="nav-number">1.1.2.</span> <span class="nav-text">优化目标</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#优化算法"><span class="nav-number">1.1.3.</span> <span class="nav-text">优化算法</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#梯度下降"><span class="nav-number">1.2.</span> <span class="nav-text">梯度下降</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#随机梯度下降"><span class="nav-number">1.2.1.</span> <span class="nav-text">随机梯度下降</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#批量梯度下降"><span class="nav-number">1.2.2.</span> <span class="nav-text">批量梯度下降</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#随机梯度下降-1"><span class="nav-number">1.2.3.</span> <span class="nav-text">随机梯度下降</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例"><span class="nav-number">1.2.4.</span> <span class="nav-text">实例</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#正规方程"><span class="nav-number">1.3.</span> <span class="nav-text">正规方程</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#梯度下降与正规方程比较"><span class="nav-number">1.4.</span> <span class="nav-text">梯度下降与正规方程比较</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#避免过拟合"><span class="nav-number">1.5.</span> <span class="nav-text">避免过拟合</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#代价函数推导"><span class="nav-number">1.6.</span> <span class="nav-text">代价函数推导</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他形式"><span class="nav-number">1.7.</span> <span class="nav-text">其他形式</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#logistic-回归"><span class="nav-number">2.</span> <span class="nav-text">logistic 回归</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#模型总览-1"><span class="nav-number">2.1.</span> <span class="nav-text">模型总览</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#模型-1"><span class="nav-number">2.1.1.</span> <span class="nav-text">模型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#优化目标-1"><span class="nav-number">2.1.2.</span> <span class="nav-text">优化目标</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#"><span class="nav-number">2.2.</span> <span class="nav-text"> </span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#梯度下降-1"><span class="nav-number">2.3.</span> <span class="nav-text">梯度下降</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#感知器"><span class="nav-number">3.</span> <span class="nav-text">感知器</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#模型总览："><span class="nav-number">3.1.</span> <span class="nav-text">模型总览：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#优缺点"><span class="nav-number">3.2.</span> <span class="nav-text">优缺点</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">uKaii</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">14.0k</span>
  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script><!-- hexo-inject:begin --><!-- Begin: Injected MathJax -->
<script type="text/x-mathjax-config">
  MathJax.Hub.Config("");
</script>

<script type="text/x-mathjax-config">
  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
      all[i].SourceElement().parentNode.className += ' has-jax';
    }
  });
</script>

<script type="text/javascript" src="">
</script>
<!-- End: Injected MathJax -->
<!-- hexo-inject:end -->
  


  

  

</body>
</html>
